﻿using System.Linq;
using DosTexPrj.Core.Models;
using DosTexPrj.Core.RepositoriesInterface;
using NHibernate;

namespace DosTexPrj.Implement.NHibernate.RepositoriesImp
{
    public class OrderRepository : Repository, IOrderRepository
    {
        public OrderRepository(ISessionFactory sessionFactory)
            : base(sessionFactory)
        {
        }

        public IQueryable<Order> LoadAllOrder()
        {
            return this.FindByCondition<Order>(x => x.IsDeleted == false);
        }

        public void DeleteOrder(Order order)
        {
            order.IsDeleted = true;
            this.Save(order);
        }
    }
}